/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mb.mbpart.memory;

/**
 *
 * @author thanh.nguyenchi
 */
public class BaseMemory {
    
    private long cachetime = 0;
    private String data;
    
    public BaseMemory(String data){
        this.data = data;
        this.cachetime = hashCode(data);
    }

    public int hashCode(String msg) {
        int hashcode = 0;

        for(int i=0;i<msg.length();i++) {            
            hashcode = (hashcode << 5) - hashcode + msg.charAt(i);
        }
        return Math.abs(hashcode);
    }
    
    /**
     * @return the cachetime
     */
    public long getCachetime() {
        return cachetime;
    }

    /**
     * @return the data
     */
    public String getData() {
        return data;
    }

}
